<?php

define('G_DONT_AUTH_REQUEST', true);
define('G_DONT_CHECKED_USER_LOGIN_STATUS', true);

define('G_OUTPUT_REQUEST_KEY', 1);
define('G_BIN_CHECK_INCLUDE', 1);

include "common.inc.php";

if(empty($_G_INPUT_['shortLink']) || !preg_match('/^[a-zA-z0-9]{3,6}$/', $_G_INPUT_['shortLink']))
{
	
	die('Short URL error. format: http://u.itupic.com/abcd ');
}

$shortLinkObj = Bin::singtolen('ShortLinkClass', 'ShortLink');

$url = $shortLinkObj->getShortLink($_G_INPUT_['shortLink']);

if(empty($url))
{
	die;
}
header('HTTP/1.0 302 Temporarily Moved');
header('Location: '.$url);

